package com.swift;

public class t3 {
    public static void main(String[] args) {
       int cnt =0;
       for (int n=2;n<=20000;n++){
           if(isPrime(n)){
               if(cnt++ % 5==0)
               {
                   System.out.println();
               }
               System.out.print(n+" ");
           }
       }
    }
    public static boolean isPrime(int n){
        if( n < 2){
            return false;
        }


        for(int i = 2; i<=Math.sqrt(n); i++){
            if(n % i == 0)
                return false;
        }
        return true;
    }
}
